package com.fadadianqi.mall.dao.ibatis;

import com.fadadianqi.commons.GenericDAOSuport;
import com.fadadianqi.mall.dao.OrdersDAO;
import com.fadadianqi.mall.orders.model.Orders;
import com.yeqiangwei.commons.util.Pagination;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by LightHuangfu
 * User: LightHuangfu
 * Date: 14-2-21
 * Time: 下午10:48
 */
@Component
public class OrdersDAOImpl extends GenericDAOSuport<String, Orders> implements OrdersDAO {
    @Override
    protected Class<Orders> getObjectClass() {
        return Orders.class;
    }

    @Override
    protected String getTableName() {
        return "mall_orders";
    }

    @Override
    public List<Orders> findAll() {
        Pagination pagination = new Pagination(1, Integer.MAX_VALUE);
        pagination.setOrderList(new Pagination.Order[]{Pagination.getNewOrder("add_time", false)});
        return super.findAll(pagination);
    }

    @Override
    public void removeById(String id) {
        super.removeByProperty("id", id);
    }
}
